import ajax from '@lib/ajax';
import { IHistory } from '@lib/types';

const URL = "work/history/";

interface IResponse {
	history: IHistory[];
}

export default async function(id: number) {
	const res = await ajax({
		url: URL + id
	});
	if (res.success) {
		const data = (res.data as IResponse);
		return data;
	} else {
		return new Error(res.error);
	}
}